home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kactionclasses.h < prev    next >
Encoding:
C/C++ Source or Header  |  2007-01-15  |  49.1 KB  |  1,423 lines

  1. /* This file is part of the KDE libraries
  2.     Copyright (C) 1999 Reginald Stadlbauer <reggie@kde.org>
  3.               (C) 1999 Simon Hausmann <hausmann@kde.org>
  4.               (C) 2000 Nicolas Hadacek <haadcek@kde.org>
  5.               (C) 2000 Kurt Granroth <granroth@kde.org>
  6.               (C) 2000 Michael Koch <koch@kde.org>
  7.               (C) 2001 Holger Freyther <freyther@kde.org>
  8.               (C) 2002 Ellis Whitehead <ellis@kde.org>
  9.               (C) 2003 Andras Mantia <amantia@kde.org>
  10.  
  11.     This library is free software; you can redistribute it and/or
  12.     modify it under the terms of the GNU Library General Public
  13.     License version 2 as published by the Free Software Foundation.
  14.  
  15.     This library is distributed in the hope that it will be useful,
  16.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  18.     Library General Public License for more details.
  19.  
  20.     You should have received a copy of the GNU Library General Public License
  21.     along with this library; see the file COPYING.LIB.  If not, write to
  22.     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  23.     Boston, MA 02110-1301, USA.
  24. */
  25. //$Id$
  26.  
  27. #ifndef __kactionclasses_h__
  28. #define __kactionclasses_h__
  29.  
  30. #include <kaction.h>
  31.  
  32. #include <qkeysequence.h>
  33. #include <qobject.h>
  34. #include <qvaluelist.h>
  35. #include <qguardedptr.h>
  36. #include <kguiitem.h>
  37. #include <kshortcut.h>
  38. #include <kstdaction.h>
  39. #include <kicontheme.h>
  40.  
  41. class QMenuBar;
  42. class QPopupMenu;
  43. class QComboBox;
  44. class QPoint;
  45. class QIconSet;
  46. class QString;
  47. class KToolBar;
  48.  
  49. class KAccel;
  50. class KAccelActions;
  51. class KConfig;
  52. class KConfigBase;
  53. class KURL;
  54. class KInstance;
  55. class KToolBar;
  56. class KActionCollection;
  57. class KPopupMenu;
  58. class KMainWindow;
  59.  
  60. /**
  61.  *  @short Checkbox like action.
  62.  *
  63.  *  Checkbox like action.
  64.  *
  65.  *  This action provides two states: checked or not.
  66.  *
  67.  */
  68. class KDEUI_EXPORT KToggleAction : public KAction
  69. {
  70.     Q_OBJECT
  71.     Q_PROPERTY( bool checked READ isChecked WRITE setChecked )
  72.     Q_PROPERTY( QString exclusiveGroup READ exclusiveGroup WRITE setExclusiveGroup )
  73. public:
  74.  
  75.     /**
  76.      * Constructs a toggle action with text and potential keyboard
  77.      * accelerator but nothing else. Use this only if you really
  78.      * know what you are doing.
  79.      *
  80.      * @param text The text that will be displayed.
  81.      * @param cut The corresponding keyboard accelerator (shortcut).
  82.      * @param parent This action's parent.
  83.      * @param name An internal name for this action.
  84.      */
  85.     KToggleAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 );
  86.  
  87.     /**
  88.      *  @param text The text that will be displayed.
  89.      *  @param cut The corresponding keyboard accelerator (shortcut).
  90.      *  @param receiver The SLOT's parent.
  91.      *  @param slot The SLOT to invoke to execute this action.
  92.      *  @param parent This action's parent.
  93.      *  @param name An internal name for this action.
  94.      */
  95.     KToggleAction( const QString& text, const KShortcut& cut,
  96.                    const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
  97.  
  98.     /**
  99.      *  @param text The text that will be displayed.
  100.      *  @param pix The icons that go with this action.
  101.      *  @param cut The corresponding keyboard accelerator (shortcut).
  102.      *  @param parent This action's parent.
  103.      *  @param name An internal name for this action.
  104.      */
  105.     KToggleAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(),
  106.              QObject* parent = 0, const char* name = 0 );
  107.  
  108.     /**
  109.      *  @param text The text that will be displayed.
  110.      *  @param pix The dynamically loaded icon that goes with this action.
  111.      *  @param cut The corresponding keyboard accelerator (shortcut).
  112.      *  @param parent This action's parent.
  113.      *  @param name An internal name for this action.
  114.      */
  115.     KToggleAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(),
  116.                    QObject* parent = 0, const char* name = 0 );
  117.  
  118.     /**
  119.      *  @param text The text that will be displayed.
  120.      *  @param pix The icons that go with this action.
  121.      *  @param cut The corresponding keyboard accelerator (shortcut).
  122.      *  @param receiver The SLOT's parent.
  123.      *  @param slot The SLOT to invoke to execute this action.
  124.      *  @param parent This action's parent.
  125.      *  @param name An internal name for this action.
  126.      */
  127.     KToggleAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
  128.                    const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
  129.  
  130.     /**
  131.      *  @param text The text that will be displayed.
  132.      *  @param pix The dynamically loaded icon that goes with this action.
  133.      *  @param cut The corresponding keyboard accelerator (shortcut).
  134.      *  @param receiver The SLOT's parent.
  135.      *  @param slot The SLOT to invoke to execute this action.
  136.      *  @param parent This action's parent.
  137.      *  @param name An internal name for this action.
  138.      */
  139.     KToggleAction( const QString& text, const QString& pix, const KShortcut& cut,
  140.                    const QObject* receiver, const char* slot,
  141.                    QObject* parent, const char* name = 0 );
  142.  
  143.     /**
  144.      *  @param parent This action's parent.
  145.      *  @param name An internal name for this action.
  146.      */
  147.     KToggleAction( QObject* parent = 0, const char* name = 0 );
  148.  
  149.     /**
  150.      * Destructor
  151.      */
  152.     virtual ~KToggleAction();
  153.  
  154.     /**
  155.      *  "Plug" or insert this action into a given widget.
  156.      *
  157.      *  This will typically be a menu or a toolbar.  From this point
  158.      *  on, you will never need to directly manipulate the item in the
  159.      *  menu or toolbar.  You do all enabling/disabling/manipulation
  160.      *  directly with your KToggleAction object.
  161.      *
  162.      *  @param widget The GUI element to display this action.
  163.      *  @param index  The index of the item.
  164.      */
  165.     virtual int plug( QWidget* widget, int index = -1 );
  166.  
  167.     /**
  168.      *  Returns the actual state of the action.
  169.      */
  170.     bool isChecked() const;
  171.  
  172.     /**
  173.      * @return which "exclusive group" this action is part of.
  174.      * @see setExclusiveGroup
  175.      */
  176.     QString exclusiveGroup() const;
  177.  
  178.     /**
  179.      * Defines which "exclusive group" this action is part of.
  180.      * In a given exclusive group, only one toggle action can be checked
  181.      * at a any moment. Checking an action unchecks the other actions
  182.      * of the group.
  183.      */
  184.     virtual void setExclusiveGroup( const QString& name );
  185.  
  186.     /**
  187.      * Defines the text (and icon, tooltip, whatsthis) that should be displayed
  188.      * instead of the normal text, when the action is checked.
  189.      * This feature replaces the checkmark that usually appears in front of the text, in menus.
  190.      * It is useful when the text is mainly a verb: e.g. "Show <foo>"
  191.      * should turn into "Hide <foo>" when activated.
  192.      *
  193.      * If hasIcon(), the icon is kept for the 'checked state', unless
  194.      * @p checkedItem defines an icon explicitely. Same thing for tooltip and whatsthis.
  195.      * @since 3.3
  196.      */
  197.     void setCheckedState( const KGuiItem& checkedItem );
  198.  
  199.     /// Reimplemented for internal reasons
  200.     virtual QString toolTip() const;
  201.  
  202. public slots:
  203.     /**
  204.      *  Sets the state of the action.
  205.      */
  206.     virtual void setChecked( bool );
  207.  
  208. protected slots:
  209.     virtual void slotActivated();
  210.  
  211. protected:
  212.     virtual void updateChecked( int id );
  213.  
  214. signals:
  215.     void toggled( bool );
  216.  
  217. protected:
  218.     virtual void virtual_hook( int id, void* data );
  219. private:
  220.     class KToggleActionPrivate;
  221.     KToggleActionPrivate *d;
  222. };
  223.  
  224. /**
  225.  *  @short Radiobox like action.
  226.  *
  227.  * An action that operates like a radio button. At any given time
  228.  * only a single action from the group will be active.
  229.  */
  230. class KDEUI_EXPORT KRadioAction : public KToggleAction
  231. {
  232.   Q_OBJECT
  233. public:
  234.     /**
  235.      * Constructs a radio action with text and potential keyboard
  236.      * accelerator but nothing else. Use this only if you really
  237.      * know what you are doing.
  238.      *
  239.      * @param text The text that will be displayed.
  240.      * @param cut The corresponding keyboard accelerator (shortcut).
  241.      * @param parent This action's parent.
  242.      * @param name An internal name for this action.
  243.      */
  244.     KRadioAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 );
  245.  
  246.     /**
  247.      *  @param text The text that will be displayed.
  248.      *  @param cut The corresponding keyboard accelerator (shortcut).
  249.      *  @param receiver The SLOT's parent.
  250.      *  @param slot The SLOT to invoke to execute this action.
  251.      *  @param parent This action's parent.
  252.      *  @param name An internal name for this action.
  253.      */
  254.     KRadioAction( const QString& text, const KShortcut& cut,
  255.                   const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
  256.  
  257.     /**
  258.      *  @param text The text that will be displayed.
  259.      *  @param pix The icons that go with this action.
  260.      *  @param cut The corresponding keyboard accelerator (shortcut).
  261.      *  @param parent This action's parent.
  262.      *  @param name An internal name for this action.
  263.      */
  264.     KRadioAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(),
  265.                   QObject* parent = 0, const char* name = 0 );
  266.  
  267.     /**
  268.      *  @param text The text that will be displayed.
  269.      *  @param pix The dynamically loaded icon that goes with this action.
  270.      *  @param cut The corresponding keyboard accelerator (shortcut).
  271.      *  @param parent This action's parent.
  272.      *  @param name An internal name for this action.
  273.      */
  274.     KRadioAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(),
  275.                   QObject* parent = 0, const char* name = 0 );
  276.  
  277.     /**
  278.      *  @param text The text that will be displayed.
  279.      *  @param pix The icons that go with this action.
  280.      *  @param cut The corresponding keyboard accelerator (shortcut).
  281.      *  @param receiver The SLOT's parent.
  282.      *  @param slot The SLOT to invoke to execute this action.
  283.      *  @param parent This action's parent.
  284.      *  @param name An internal name for this action.
  285.      */
  286.     KRadioAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
  287.                   const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
  288.  
  289.     /**
  290.      *  @param text The text that will be displayed.
  291.      *  @param pix The dynamically loaded icon that goes with this action.
  292.      *  @param cut The corresponding keyboard accelerator (shortcut).
  293.      *  @param receiver The SLOT's parent.
  294.      *  @param slot The SLOT to invoke to execute this action.
  295.      *  @param parent This action's parent.
  296.      *  @param name An internal name for this action.
  297.      */
  298.     KRadioAction( const QString& text, const QString& pix, const KShortcut& cut,
  299.                   const QObject* receiver, const char* slot,
  300.                   QObject* parent, const char* name = 0 );
  301.  
  302.     /**
  303.      *  @param parent This action's parent.
  304.      *  @param name An internal name for this action.
  305.      */
  306.     KRadioAction( QObject* parent = 0, const char* name = 0 );
  307.  
  308. protected:
  309.     virtual void slotActivated();
  310.  
  311. protected:
  312.     virtual void virtual_hook( int id, void* data );
  313. private:
  314.     class KRadioActionPrivate;
  315.     KRadioActionPrivate *d;
  316. };
  317.  
  318. /**
  319.  *  @short Action for selecting one of several items
  320.  *
  321.  *  Action for selecting one of several items.
  322.  *
  323.  *  This action shows up a submenu with a list of items.
  324.  *  One of them can be checked. If the user clicks on an item
  325.  *  this item will automatically be checked,
  326.  *  the formerly checked item becomes unchecked.
  327.  *  There can be only one item checked at a time.
  328.  */
  329. class KDEUI_EXPORT KSelectAction : public KAction
  330. {
  331.     Q_OBJECT
  332.     Q_PROPERTY( int currentItem READ currentItem WRITE setCurrentItem )
  333.     Q_PROPERTY( QStringList items READ items WRITE setItems )
  334.     Q_PROPERTY( bool editable READ isEditable WRITE setEditable )
  335.     Q_PROPERTY( int comboWidth READ comboWidth WRITE setComboWidth )
  336.     Q_PROPERTY( QString currentText READ currentText )
  337.     Q_PROPERTY( bool menuAccelsEnabled READ menuAccelsEnabled WRITE setMenuAccelsEnabled )
  338. public:
  339.  
  340.     /**
  341.      * Constructs a select action with text and potential keyboard
  342.      * accelerator but nothing else. Use this only if you really
  343.      * know what you are doing.
  344.      *
  345.      * @param text The text that will be displayed.
  346.      * @param cut The corresponding keyboard accelerator (shortcut).
  347.      * @param parent This action's parent.
  348.      * @param name An internal name for this action.
  349.      */
  350.     KSelectAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 );
  351.  
  352.     /**
  353.      *  @param text The text that will be displayed.
  354.      *  @param cut The corresponding keyboard accelerator (shortcut).
  355.      *  @param receiver The SLOT's parent.
  356.      *  @param slot The SLOT to invoke to execute this action.
  357.      *  @param parent This action's parent.
  358.      *  @param name An internal name for this action.
  359.      */
  360.     KSelectAction( const QString& text, const KShortcut& cut,
  361.                    const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
  362.  
  363.     /**
  364.      *  @param text The text that will be displayed.
  365.      *  @param pix The icons that go with this action.
  366.      *  @param cut The corresponding keyboard accelerator (shortcut).
  367.      *  @param parent This action's parent.
  368.      *  @param name An internal name for this action.
  369.      */
  370.     KSelectAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(),
  371.              QObject* parent = 0, const char* name = 0 );
  372.  
  373.     /**
  374.      *  @param text The text that will be displayed.
  375.      *  @param pix The dynamically loaded icon that goes with this action.
  376.      *  @param cut The corresponding keyboard accelerator (shortcut).
  377.      *  @param parent This action's parent.
  378.      *  @param name An internal name for this action.
  379.      */
  380.     KSelectAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(),
  381.                    QObject* parent = 0, const char* name = 0 );
  382.  
  383.     /**
  384.      *  @param text The text that will be displayed.
  385.      *  @param pix The icons that go with this action.
  386.      *  @param cut The corresponding keyboard accelerator (shortcut).
  387.      *  @param receiver The SLOT's parent.
  388.      *  @param slot The SLOT to invoke to execute this action.
  389.      *  @param parent This action's parent.
  390.      *  @param name An internal name for this action.
  391.      */
  392.     KSelectAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
  393.                    const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
  394.  
  395.     /**
  396.      *  @param text The text that will be displayed.
  397.      *  @param pix The dynamically loaded icon that goes with this action.
  398.      *  @param cut The corresponding keyboard accelerator (shortcut).
  399.      *  @param receiver The SLOT's parent.
  400.      *  @param slot The SLOT to invoke to execute this action.
  401.      *  @param parent This action's parent.
  402.      *  @param name An internal name for this action.
  403.      */
  404.     KSelectAction( const QString& text, const QString& pix, const KShortcut& cut,
  405.                    const QObject* receiver, const char* slot,
  406.                    QObject* parent, const char* name = 0 );
  407.  
  408.     /**
  409.      *  @param parent This action's parent.
  410.      *  @param name An internal name for this action.
  411.      */
  412.     KSelectAction( QObject* parent = 0, const char* name = 0 );
  413.  
  414.     /**
  415.      * Destructor
  416.      */
  417.     virtual ~KSelectAction();
  418.  
  419.     /**
  420.      *  "Plug" or insert this action into a given widget.
  421.      *
  422.      *  This will typically be a menu or a toolbar.
  423.      *  From this point on, you will never need to directly
  424.      *  manipulate the item in the menu or toolbar.
  425.      *  You do all enabling/disabling/manipulation directly with your KSelectAction object.
  426.      *
  427.      *  @param widget The GUI element to display this action.
  428.      *  @param index  The index of the item.
  429.      */
  430.     virtual int plug( QWidget* widget, int index = -1 );
  431.  
  432.     /**
  433.      * When this action is plugged into a toolbar, it creates a combobox.
  434.      * @return true if the combo editable.
  435.      */
  436.     virtual bool isEditable() const;
  437.  
  438.     /**
  439.      * @return the items that can be selected with this action.
  440.      * Use setItems to set them.
  441.      */
  442.     virtual QStringList items() const;
  443.  
  444.     /**
  445.      * Changes the text of item @param index to @param text .
  446.      */
  447.     virtual void changeItem( int index, const QString& text );
  448.  
  449.     /**
  450.      * Returns the text of the currently selected item.
  451.      */
  452.     virtual QString currentText() const;
  453.  
  454.     /**
  455.      * Returns the index of the current item.
  456.      * @see setCurrentItem
  457.      */
  458.     virtual int currentItem() const;
  459.  
  460.     /**
  461.      * When this action is plugged into a toolbar, it creates a combobox.
  462.      * This returns the maximum width set by setComboWidth
  463.      */
  464.     virtual int comboWidth() const;
  465.  
  466.     /**
  467.      * Sets the maximum items that are visible at once if the action
  468.      * is a combobox, that is the number of items in the combobox's viewport
  469.      * Only works before the action is plugged
  470.      * @since 3.5
  471.      */
  472.     void setMaxComboViewCount( int n );
  473.  
  474.     /**
  475.      * Returns a pointer to the popup menu used by this action.
  476.      */
  477.     QPopupMenu* popupMenu() const;
  478.  
  479.     /**
  480.      * @deprecated See setMenuAccelsEnabled .
  481.      * @since 3.1
  482.      */
  483.     void setRemoveAmpersandsInCombo( bool b ) KDE_DEPRECATED;
  484.     /// @since 3.1
  485.     bool removeAmpersandsInCombo() const;
  486.  
  487.     /**
  488.      * Sets whether any occurrence of the ampersand character ( & ) in items
  489.      * should be interpreted as keyboard accelerator for items displayed in a
  490.      * menu or not.
  491.      * @since 3.1
  492.      */
  493.     void setMenuAccelsEnabled( bool b );
  494.     /// @since 3.1
  495.     bool menuAccelsEnabled() const;
  496.  
  497.     virtual bool isShortcutConfigurable() const { return false; }
  498.  
  499. public slots:
  500.     /**
  501.      *  Sets the currently checked item.
  502.      *
  503.      *  @param index Index of the item (remember the first item is zero).
  504.      */
  505.     virtual void setCurrentItem( int index );
  506.  
  507.     /**
  508.      * Sets the items to be displayed in this action
  509.      * You need to call this.
  510.      */
  511.     virtual void setItems( const QStringList &lst );
  512.  
  513.     /**
  514.      * Clears up all the items in this action
  515.      */
  516.     virtual void clear();
  517.  
  518.     /**
  519.      * When this action is plugged into a toolbar, it creates a combobox.
  520.      * This makes the combo editable or read-only.
  521.      */
  522.     virtual void setEditable( bool );
  523.  
  524.     /**
  525.      * When this action is plugged into a toolbar, it creates a combobox.
  526.      * This gives a _maximum_ size to the combobox.
  527.      * The minimum size is automatically given by the contents (the items).
  528.      */
  529.     virtual void setComboWidth( int width );
  530.  
  531. protected:
  532.     virtual void changeItem( int id, int index, const QString& text );
  533.  
  534.     /**
  535.      * Depending on the menuAccelsEnabled property this method will return the
  536.      * actions items in a way for inclusion in a combobox with the ampersand
  537.      * character removed from all items or not.
  538.      * @since 3.1
  539.      */
  540.     QStringList comboItems() const;
  541.  
  542. protected slots:
  543.     virtual void slotActivated( int id );
  544.     virtual void slotActivated( const QString &text );
  545.     virtual void slotActivated();
  546.  
  547. signals:
  548.     /**
  549.      * This signal is emitted when an item is selected; @param index indicated
  550.      * the item selected.
  551.      */
  552.     void activated( int index );
  553.     /**
  554.      * This signal is emitted when an item is selected; @param text indicates
  555.      * the item selected.
  556.      */
  557.     void activated( const QString& text );
  558.  
  559. protected:
  560.     virtual void updateCurrentItem( int id );
  561.  
  562.     virtual void updateComboWidth( int id );
  563.  
  564.     virtual void updateItems( int id );
  565.  
  566.     virtual void updateClear( int id );
  567.  
  568. protected:
  569.     virtual void virtual_hook( int id, void* data );
  570. private:
  571.     void setupMenu() const;
  572.     class KSelectActionPrivate;
  573.     KSelectActionPrivate *d;
  574.  
  575. };
  576.  
  577. /// Remove this class in KDE-4.0. It doesn't add _anything_ to KSelectAction
  578. /**
  579.  * @deprecated Use KSelectAction instead.
  580.  */
  581. class KDEUI_EXPORT_DEPRECATED KListAction : public KSelectAction
  582. {
  583.     Q_OBJECT
  584. public:
  585.     /**
  586.      * Constructs a list action with text and potential keyboard
  587.      * accelerator but nothing else. Use this only if you really
  588.      * know what you are doing.
  589.      *
  590.      * @param text The text that will be displayed.
  591.      * @param cut The corresponding keyboard accelerator (shortcut).
  592.      * @param parent This action's parent.
  593.      * @param name An internal name for this action.
  594.      */
  595.     KListAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0,
  596.                   const char* name = 0 );
  597.  
  598.     /**
  599.      *  @param text The text that will be displayed.
  600.      *  @param cut The corresponding keyboard accelerator (shortcut).
  601.      *  @param receiver The SLOT's parent.
  602.      *  @param slot The SLOT to invoke to execute this action.
  603.      *  @param parent This action's parent.
  604.      *  @param name An internal name for this action.
  605.      */
  606.     KListAction( const QString& text, const KShortcut& cut, const QObject* receiver,
  607.                   const char* slot, QObject* parent, const char* name = 0 );
  608.  
  609.     /**
  610.      *  @param text The text that will be displayed.
  611.      *  @param pix The icons that go with this action.
  612.      *  @param cut The corresponding keyboard accelerator (shortcut).
  613.      *  @param parent This action's parent.
  614.      *  @param name An internal name for this action.
  615.      */
  616.     KListAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(),
  617.                       QObject* parent = 0, const char* name = 0 );
  618.  
  619.     /**
  620.      *  @param text The text that will be displayed.
  621.      *  @param pix The dynamically loaded icon that goes with this action.
  622.      *  @param cut The corresponding keyboard accelerator (shortcut).
  623.      *  @param parent This action's parent.
  624.      *  @param name An internal name for this action.
  625.      */
  626.     KListAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(),
  627.                       QObject* parent = 0, const char* name = 0 );
  628.  
  629.     /**
  630.      *  @param text The text that will be displayed.
  631.      *  @param pix The icons that go with this action.
  632.      *  @param cut The corresponding keyboard accelerator (shortcut).
  633.      *  @param receiver The SLOT's parent.
  634.      *  @param slot The SLOT to invoke to execute this action.
  635.      *  @param parent This action's parent.
  636.      *  @param name An internal name for this action.
  637.      */
  638.     KListAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
  639.                           const QObject* receiver, const char* slot, QObject* parent,
  640.                   const char* name = 0 );
  641.  
  642.     /**
  643.      *  @param text The text that will be displayed.
  644.      *  @param pix The dynamically loaded icon that goes with this action.
  645.      *  @param cut The corresponding keyboard accelerator (shortcut).
  646.      *  @param receiver The SLOT's parent.
  647.      *  @param slot The SLOT to invoke to execute this action.
  648.      *  @param parent This action's parent.
  649.      *  @param name An internal name for this action.
  650.      */
  651.     KListAction( const QString& text, const QString& pix, const KShortcut& cut,
  652.                  const QObject* receiver, const char* slot, QObject* parent,
  653.                  const char* name = 0 );
  654.  
  655.     /**
  656.      *  @param parent This action's parent.
  657.      *  @param name An internal name for this action.
  658.      */
  659.     KListAction( QObject* parent = 0, const char* name = 0 );
  660.  
  661.     /**
  662.      * Destructor
  663.      */
  664.     virtual ~KListAction();
  665.  
  666.  
  667.     virtual QString currentText() const;
  668.     virtual int currentItem() const;
  669.  
  670.  
  671. public slots:
  672.     /**
  673.      *  Sets the currently checked item.
  674.      *
  675.      *  @param index Index of the item (remember the first item is zero).
  676.      */
  677.     virtual void setCurrentItem( int index );
  678.  
  679. protected:
  680.     virtual void virtual_hook( int id, void* data );
  681. private:
  682.     class KListActionPrivate;
  683.     KListActionPrivate *d;
  684. };
  685.  
  686. /**
  687.  *  @short Recent files action
  688.  *
  689.  *  This class is an action to handle a recent files submenu.
  690.  *  The best way to create the action is to use KStdAction::openRecent.
  691.  *  Then you simply need to call loadEntries on startup, saveEntries
  692.  *  on shutdown, addURL when your application loads/saves a file.
  693.  *
  694.  *  @author Michael Koch
  695.  */
  696. class KDEUI_EXPORT KRecentFilesAction : public KListAction  // TODO public KSelectAction
  697. {
  698.   Q_OBJECT
  699.   Q_PROPERTY( uint maxItems READ maxItems WRITE setMaxItems )
  700. public:
  701.   /**
  702.    *  @param text The text that will be displayed.
  703.    *  @param cut The corresponding keyboard accelerator (shortcut).
  704.    *  @param parent This action's parent.
  705.    *  @param name An internal name for this action.
  706.    *  @param maxItems The maximum number of files to display
  707.    */
  708.   KRecentFilesAction( const QString& text, const KShortcut& cut,
  709.                       QObject* parent, const char* name = 0,
  710.                       uint maxItems = 10 );
  711.  
  712.   /**
  713.    *  @param text The text that will be displayed.
  714.    *  @param cut The corresponding keyboard accelerator (shortcut).
  715.    *  @param receiver The SLOT's parent.
  716.    *  @param slot The SLOT to invoke when a URL is selected.
  717.    *  Its signature is of the form slotURLSelected( const KURL & ).
  718.    *  @param parent This action's parent.
  719.    *  @param name An internal name for this action.
  720.    *  @param maxItems The maximum number of files to display
  721.    */
  722.   KRecentFilesAction( const QString& text, const KShortcut& cut,
  723.                       const QObject* receiver, const char* slot,
  724.                       QObject* parent, const char* name = 0,
  725.                       uint maxItems = 10 );
  726.  
  727.   /**
  728.    *  @param text The text that will be displayed.
  729.    *  @param pix The icons that go with this action.
  730.    *  @param cut The corresponding keyboard accelerator (shortcut).
  731.    *  @param parent This action's parent.
  732.    *  @param name An internal name for this action.
  733.    *  @param maxItems The maximum number of files to display
  734.    */
  735.   KRecentFilesAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
  736.                       QObject* parent, const char* name = 0,
  737.                       uint maxItems = 10 );
  738.  
  739.   /**
  740.    *  @param text The text that will be displayed.
  741.    *  @param pix The dynamically loaded icon that goes with this action.
  742.    *  @param cut The corresponding keyboard accelerator (shortcut).
  743.    *  @param parent This action's parent.
  744.    *  @param name An internal name for this action.
  745.    *  @param maxItems The maximum number of files to display
  746.    */
  747.   KRecentFilesAction( const QString& text, const QString& pix, const KShortcut& cut,
  748.                       QObject* parent, const char* name = 0,
  749.                       uint maxItems = 10 );
  750.  
  751.   /**
  752.    *  @param text The text that will be displayed.
  753.    *  @param pix The icons that go with this action.
  754.    *  @param cut The corresponding keyboard accelerator (shortcut).
  755.    *  @param receiver The SLOT's parent.
  756.    *  @param slot The SLOT to invoke when a URL is selected.
  757.    *  Its signature is of the form slotURLSelected( const KURL & ).
  758.    *  @param parent This action's parent.
  759.    *  @param name An internal name for this action.
  760.    *  @param maxItems The maximum number of files to display
  761.    */
  762.   KRecentFilesAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
  763.                       const QObject* receiver, const char* slot,
  764.                       QObject* parent, const char* name = 0,
  765.                       uint maxItems = 10 );
  766.  
  767.   /**
  768.    *  @param text The text that will be displayed.
  769.    *  @param pix The dynamically loaded icon that goes with this action.
  770.    *  @param cut The corresponding keyboard accelerator (shortcut).
  771.    *  @param receiver The SLOT's parent.
  772.    *  @param slot The SLOT to invoke when a URL is selected.
  773.    *  Its signature is of the form slotURLSelected( const KURL & ).
  774.    *  @param parent This action's parent.
  775.    *  @param name An internal name for this action.
  776.    *  @param maxItems The maximum number of files to display
  777.    */
  778.   KRecentFilesAction( const QString& text, const QString& pix, const KShortcut& cut,
  779.                       const QObject* receiver, const char* slot,
  780.                       QObject* parent, const char* name = 0,
  781.                       uint maxItems = 10 );
  782.  
  783.   /**
  784.    *  @param parent This action's parent.
  785.    *  @param name An internal name for this action.
  786.    *  @param maxItems The maximum number of files to display
  787.    */
  788.   KRecentFilesAction( QObject* parent = 0, const char* name = 0,
  789.                       uint maxItems = 10 );
  790.  
  791.   /**
  792.    *  Destructor.
  793.    */
  794.   virtual ~KRecentFilesAction();
  795.  
  796.   virtual int plug( QWidget *widget, int index = -1 );
  797.  
  798.   /**
  799.    *  Returns the maximum of items in the recent files list.
  800.    */
  801.   uint maxItems() const;
  802.  
  803. //KDE4: remove completeItems() and rename items() to urls(), to get the list of URLs added to
  804. //      the action.
  805.   /**
  806.     * @return the items that can be selected with this action.
  807.     * The returned items do not contain the pretty name that can be set by addURL,
  808.     * matching the pre-3.5 behavior.
  809.     */
  810.  
  811.   virtual QStringList items() const;
  812.  
  813.   /**
  814.     * @return the items that can be selected with this action.
  815.     * The returned items contain the pretty name that can be set by addURL.
  816.     * @since 3.5
  817.     */
  818.   QStringList completeItems() const;
  819.  
  820. public slots:
  821.   /**
  822.    *  Sets the maximum of items in the recent files list.
  823.    *  The default for this value is 10 set in the constructor.
  824.    *
  825.    *  If this value is lesser than the number of items currently
  826.    *  in the recent files list the last items are deleted until
  827.    *  the number of items are equal to the new maximum.
  828.    */
  829.   void setMaxItems( uint maxItems );
  830.  
  831.   /**
  832.    *  Loads the recent files entries from a given KConfig object.
  833.    *  You can provide the name of the group used to load the entries.
  834.    *  If the groupname is empty, entries are load from a group called 'RecentFiles'
  835.    *
  836.    *  This method does not effect the active group of KConfig.
  837.    */
  838.   void loadEntries( KConfig* config, QString groupname=QString::null );
  839.  
  840.   /**
  841.    *  Saves the current recent files entries to a given KConfig object.
  842.    *  You can provide the name of the group used to load the entries.
  843.    *  If the groupname is empty, entries are saved to a group called 'RecentFiles'
  844.    *
  845.    *  This method does not effect the active group of KConfig.
  846.    */
  847.   void saveEntries( KConfig* config, QString groupname=QString::null );
  848.  
  849.   /**
  850.    *  Add URL to recent files list.
  851.    *
  852.    *  @param url The URL of the file
  853.    */
  854.   void addURL( const KURL& url );
  855.  
  856.   /**
  857.    *  Add URL to recent files list.
  858.    *
  859.    *  @param url The URL of the file
  860.    *  @param name The user visible pretty name that appears before the URL
  861.    *  @since 3.5
  862.    */
  863.   void addURL( const KURL& url, const QString& name ); //KDE4: Combine the above two methods
  864.  
  865.   /**
  866.    *  Remove an URL from the recent files list.
  867.    *
  868.    *  @param url The URL of the file
  869.    */
  870.   void removeURL( const KURL& url );
  871.  
  872.   /**
  873.    *  Removes all entries from the recent files list.
  874.    */
  875.   void clearURLList();
  876.  
  877. signals:
  878.  
  879.   /**
  880.    *  This signal gets emited when the user selects an URL.
  881.    *
  882.    *  @param url The URL thats the user selected.
  883.    */
  884.   void urlSelected( const KURL& url );
  885.  
  886. protected slots:
  887.   void itemSelected( const QString& string );
  888.   void menuAboutToShow();
  889.   void menuItemActivated( int id );
  890.   void slotClicked();
  891.   virtual void slotActivated(int);
  892.   virtual void slotActivated(const QString& );
  893.   virtual void slotActivated();
  894.  
  895. protected:
  896.   virtual void virtual_hook( int id, void* data );
  897.  
  898. private:
  899.   void init();
  900.  
  901.   class KRecentFilesActionPrivate;
  902.   KRecentFilesActionPrivate *d;
  903. };
  904.  
  905. class KDEUI_EXPORT KFontAction : public KSelectAction
  906. {
  907.     Q_OBJECT
  908.     Q_PROPERTY( QString font READ font WRITE setFont )
  909. public:
  910.     KFontAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0,
  911.                  const char* name = 0 );
  912.     KFontAction( const QString& text, const KShortcut& cut,
  913.                  const QObject* receiver, const char* slot, QObject* parent,
  914.                  const char* name = 0 );
  915.     KFontAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(),
  916.                  QObject* parent = 0, const char* name = 0 );
  917.     KFontAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(),
  918.                  QObject* parent = 0, const char* name = 0 );
  919.     KFontAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
  920.                  const QObject* receiver, const char* slot, QObject* parent,
  921.                  const char* name = 0 );
  922.     KFontAction( const QString& text, const QString& pix, const KShortcut& cut,
  923.                  const QObject* receiver, const char* slot, QObject* parent,
  924.                  const char* name = 0 );
  925.  
  926. // The ctors with fontListCriteria were added after 3.3-beta1.
  927. // This define is used in koffice. Remove when koffice has a dependency on kdelibs-3.3 or more.
  928. #define KFONTACTION_HAS_CRITERIA_ARG
  929.     KFontAction( uint fontListCriteria, const QString& text,
  930.                  const KShortcut& cut = KShortcut(), QObject* parent = 0,
  931.                  const char* name = 0 );
  932.     KFontAction( uint fontListCriteria, const QString& text, const QString& pix,
  933.                  const KShortcut& cut = KShortcut(),
  934.                  QObject* parent = 0, const char* name = 0 );
  935.  
  936.     KFontAction( QObject* parent = 0, const char* name = 0 );
  937.     ~KFontAction();
  938.  
  939.     QString font() const {
  940.         return currentText();
  941.     }
  942.  
  943.     int plug( QWidget*widget, int index = -1 );
  944.  
  945. public slots:
  946.     void setFont( const QString &family );
  947.  
  948. protected:
  949.     virtual void virtual_hook( int id, void* data );
  950. private:
  951.     class KFontActionPrivate;
  952.     KFontActionPrivate *d;
  953. };
  954.  
  955. class KDEUI_EXPORT KFontSizeAction : public KSelectAction
  956. {
  957.     Q_OBJECT
  958.     Q_PROPERTY( int fontSize READ fontSize WRITE setFontSize )
  959. public:
  960.     KFontSizeAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0,
  961.                      const char* name = 0 );
  962.     KFontSizeAction( const QString& text, const KShortcut& cut, const QObject* receiver,
  963.                      const char* slot, QObject* parent, const char* name = 0 );
  964.     KFontSizeAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(),
  965.                      QObject* parent = 0, const char* name = 0 );
  966.     KFontSizeAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(),
  967.                      QObject* parent = 0, const char* name = 0 );
  968.     KFontSizeAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
  969.                      const QObject* receiver, const char* slot,
  970.                      QObject* parent, const char* name = 0 );
  971.     KFontSizeAction( const QString& text, const QString& pix, const KShortcut& cut,
  972.                      const QObject* receiver, const char* slot,
  973.                      QObject* parent, const char* name = 0 );
  974.     KFontSizeAction( QObject* parent = 0, const char* name = 0 );
  975.  
  976.     virtual ~KFontSizeAction();
  977.  
  978.     virtual int fontSize() const;
  979.  
  980. public slots:
  981.     virtual void setFontSize( int size );
  982.  
  983. protected slots:
  984.     virtual void slotActivated( int );
  985.     virtual void slotActivated( const QString& );
  986.     virtual void slotActivated() { KAction::slotActivated(); }
  987.  
  988. signals:
  989.     void fontSizeChanged( int );
  990.  
  991. private:
  992.     void init();
  993.  
  994.  
  995. protected:
  996.     virtual void virtual_hook( int id, void* data );
  997. private:
  998.     class KFontSizeActionPrivate;
  999.     KFontSizeActionPrivate *d;
  1000. };
  1001.  
  1002.  
  1003. /**
  1004.  * A KActionMenu is an action that holds a sub-menu of other actions.
  1005.  * insert() and remove() allow to insert and remove actions into this action-menu.
  1006.  * Plugged in a popupmenu, it will create a submenu.
  1007.  * Plugged in a toolbar, it will create a button with a popup menu.
  1008.  *
  1009.  * This is the action used by the XMLGUI since it holds other actions.
  1010.  * If you want a submenu for selecting one tool among many (without icons), see KSelectAction.
  1011.  * See also setDelayed about the main action.
  1012.  */
  1013. class KDEUI_EXPORT KActionMenu : public KAction
  1014. {
  1015.   Q_OBJECT
  1016.   Q_PROPERTY( bool delayed READ delayed WRITE setDelayed )
  1017.   Q_PROPERTY( bool stickyMenu READ stickyMenu WRITE setStickyMenu )
  1018.  
  1019. public:
  1020.     KActionMenu( const QString& text, QObject* parent = 0,
  1021.                  const char* name = 0 );
  1022.     KActionMenu( const QString& text, const QIconSet& icon,
  1023.                  QObject* parent = 0, const char* name = 0 );
  1024.     KActionMenu( const QString& text, const QString& icon,
  1025.                  QObject* parent = 0, const char* name = 0 );
  1026.     KActionMenu( QObject* parent = 0, const char* name = 0 );
  1027.     virtual ~KActionMenu();
  1028.  
  1029.     virtual void insert( KAction*, int index = -1 );
  1030.     virtual void remove( KAction* );
  1031.  
  1032.     KPopupMenu* popupMenu() const;
  1033.     void popup( const QPoint& global );
  1034.  
  1035.     /**
  1036.      * Returns true if this action creates a delayed popup menu
  1037.      * when plugged in a KToolbar.
  1038.      */
  1039.     bool delayed() const;
  1040.     /**
  1041.      * If set to true, this action will create a delayed popup menu
  1042.      * when plugged in a KToolbar. Otherwise it creates a normal popup.
  1043.      * Default: delayed
  1044.      *
  1045.      * Remember that if the "main" action (the toolbar button itself)
  1046.      * cannot be clicked, then you should call setDelayed(false).
  1047.      *
  1048.      * On the opposite, if the main action can be clicked, it can only happen
  1049.      * in a toolbar: in a menu, the parent of a submenu can't be activated.
  1050.      * To get a "normal" menu item when plugged a menu (and no submenu)
  1051.      * use KToolBarPopupAction.
  1052.      */
  1053.     void setDelayed(bool _delayed);
  1054.  
  1055.     /**
  1056.      * Returns true if this action creates a sticky popup menu.
  1057.      * See setStickyMenu().
  1058.      */
  1059.     bool stickyMenu() const;
  1060.     /**
  1061.      * If set to true, this action will create a sticky popup menu
  1062.      * when plugged in a KToolbar.
  1063.      * "Sticky", means it's visible until a selection is made or the mouse is
  1064.      * clicked elsewhere. This feature allows you to make a selection without
  1065.      * having to press and hold down the mouse while making a selection.
  1066.      * Default: sticky.
  1067.      */
  1068.     void setStickyMenu(bool sticky);
  1069.  
  1070.     virtual int plug( QWidget* widget, int index = -1 );
  1071.  
  1072. protected:
  1073.     virtual void virtual_hook( int id, void* data );
  1074. private:
  1075.     class KActionMenuPrivate;
  1076.     KActionMenuPrivate *d;
  1077. };
  1078.  
  1079. /**
  1080.  * This action is a normal action everywhere, except in a toolbar
  1081.  * where it also has a popupmenu (optionnally delayed). This action is designed
  1082.  * for history actions (back/forward, undo/redo) and for any other action
  1083.  * that has more detail in a toolbar than in a menu (e.g. tool chooser
  1084.  * with "Other" leading to a dialog...).
  1085.  */
  1086. class KDEUI_EXPORT KToolBarPopupAction : public KAction
  1087. {
  1088.   Q_OBJECT
  1089.   Q_PROPERTY( bool delayed READ delayed WRITE setDelayed )
  1090.   Q_PROPERTY( bool stickyMenu READ stickyMenu WRITE setStickyMenu )
  1091.  
  1092. public:
  1093.     //Not all constructors - because we need an icon, since this action only makes
  1094.     // sense when being plugged at least in a toolbar.
  1095.     /**
  1096.      * Create a KToolBarPopupAction, with a text, an icon, an optional accelerator,
  1097.      * parent and name.
  1098.      *
  1099.      * @param text The text that will be displayed.
  1100.      * @param icon The icon to display.
  1101.      * @param cut The corresponding keyboard accelerator (shortcut).
  1102.      * @param parent This action's parent.
  1103.      * @param name An internal name for this action.
  1104.      */
  1105.     KToolBarPopupAction( const QString& text, const QString& icon, const KShortcut& cut = KShortcut(),
  1106.                          QObject* parent = 0, const char* name = 0 );
  1107.  
  1108.     /**
  1109.      * Create a KToolBarPopupAction, with a text, an icon, an accelerator,
  1110.      * a slot connected to the action, parent and name.
  1111.      *
  1112.      * If you do not want or have a keyboard accelerator, set the
  1113.      * @p cut param to 0.
  1114.      *
  1115.      * @param text The text that will be displayed.
  1116.      * @param icon The icon to display.
  1117.      * @param cut The corresponding keyboard accelerator (shortcut).
  1118.      * @param receiver The SLOT's owner.
  1119.      * @param slot The SLOT to invoke to execute this action.
  1120.      * @param parent This action's parent.
  1121.      * @param name An internal name for this action.
  1122.      */
  1123.     KToolBarPopupAction( const QString& text, const QString& icon, const KShortcut& cut,
  1124.                          const QObject* receiver, const char* slot,
  1125.                          QObject* parent = 0, const char* name = 0 );
  1126.  
  1127.     /**
  1128.      * Create a KToolBarPopupAction, with a KGuiItem, an accelerator,
  1129.      * a slot connected to the action, parent and name. The text and the
  1130.      * icon are taken from the KGuiItem.
  1131.      *
  1132.      * If you do not want or have a keyboard accelerator, set the
  1133.      * @p cut param to 0.
  1134.      *
  1135.      * @param item The text and icon that will be displayed.
  1136.      * @param cut The corresponding keyboard accelerator (shortcut).
  1137.      * @param receiver The SLOT's owner.
  1138.      * @param slot The SLOT to invoke to execute this action.
  1139.      * @param parent This action's parent.
  1140.      * @param name An internal name for this action.
  1141.      */
  1142.     KToolBarPopupAction( const KGuiItem& item, const KShortcut& cut,
  1143.                          const QObject* receiver, const char* slot,
  1144.                          KActionCollection* parent, const char* name );
  1145.  
  1146.     virtual ~KToolBarPopupAction();
  1147.  
  1148.     virtual int plug( QWidget *widget, int index = -1 );
  1149.  
  1150.     /**
  1151.      * The popup menu that is shown when clicking (some time) on the toolbar
  1152.      * button. You may want to plug items into it on creation, or connect to
  1153.      * aboutToShow for a more dynamic menu.
  1154.      */
  1155.     KPopupMenu *popupMenu() const;
  1156.  
  1157.     /**
  1158.      * Returns true if this action creates a delayed popup menu
  1159.      * when plugged in a KToolbar.
  1160.      */
  1161.     bool delayed() const;
  1162.     /**
  1163.      * If set to true, this action will create a delayed popup menu
  1164.      * when plugged in a KToolbar. Otherwise it creates a normal popup.
  1165.      * Default: delayed.
  1166.      */
  1167.     void setDelayed(bool delayed);
  1168.     /**
  1169.      * Returns true if this action creates a sticky popup menu.
  1170.      * See setStickyMenu().
  1171.      */
  1172.     bool stickyMenu() const;
  1173.     /**
  1174.      * If set to true, this action will create a sticky popup menu
  1175.      * when plugged in a KToolbar.
  1176.      * "Sticky", means it's visible until a selection is made or the mouse is
  1177.      * clicked elsewhere. This feature allows you to make a selection without
  1178.      * having to press and hold down the mouse while making a selection.
  1179.      * Only available if delayed() is true.
  1180.      * Default: sticky.
  1181.      */
  1182.     void setStickyMenu(bool sticky);
  1183.  
  1184. private:
  1185.     KPopupMenu *m_popup;
  1186.     bool m_delayed:1;
  1187.     bool m_stickyMenu:1;
  1188. protected:
  1189.     virtual void virtual_hook( int id, void* data );
  1190. private:
  1191.     class KToolBarPopupActionPrivate;
  1192.     KToolBarPopupActionPrivate *d;
  1193. };
  1194.  
  1195. /**
  1196.  * An action that takes care of everything associated with
  1197.  * showing or hiding a toolbar by a menu action. It will
  1198.  * show or hide the toolbar with the given name when
  1199.  * activated, and check or uncheck itself if the toolbar
  1200.  * is manually shown or hidden.
  1201.  *
  1202.  * If you need to perfom some additional action when the
  1203.  * toolbar is shown or hidden, connect to the toggled(bool)
  1204.  * signal. It will be emitted after the toolbar's
  1205.  * visibility has changed, whenever it changes.
  1206.  * @since 3.1
  1207.  */
  1208. class KDEUI_EXPORT KToggleToolBarAction : public KToggleAction
  1209. {
  1210.     Q_OBJECT
  1211. public:
  1212.     /**
  1213.      * Create a KToggleToolbarAction that manages the toolbar
  1214.      * named toolBarName. This can be either the name of a
  1215.      * toolbar in an xml ui file, or a toolbar programmatically
  1216.      * created with that name.
  1217.      */
  1218.     KToggleToolBarAction( const char* toolBarName, const QString& text,
  1219.                           KActionCollection* parent, const char* name );
  1220.     KToggleToolBarAction( KToolBar *toolBar, const QString &text,
  1221.                           KActionCollection *parent, const char *name );
  1222.     virtual ~KToggleToolBarAction();
  1223.  
  1224.     virtual int plug( QWidget * widget, int index = -1 );
  1225.  
  1226.     KToolBar *toolBar() { return m_toolBar; }
  1227.  
  1228. public slots:
  1229.     virtual void setChecked( bool );
  1230.  
  1231. private:
  1232.     QCString               m_toolBarName;
  1233.     QGuardedPtr<KToolBar>  m_toolBar;
  1234. protected:
  1235.     virtual void virtual_hook( int id, void* data );
  1236. private:
  1237.     class KToggleToolBarActionPrivate;
  1238.     KToggleToolBarActionPrivate *d;
  1239. };
  1240.  
  1241. /**
  1242.  * An action for switching between to/from full screen mode. Note that
  1243.  * QWidget::isFullScreen() may reflect the new or the old state
  1244.  * depending on how the action was triggered (by the application or
  1245.  * from the window manager). Also don't try to track the window state
  1246.  * yourself. Rely on this action's state (isChecked()) instead.
  1247.  *
  1248.  * Important: If you need to set/change the fullscreen state manually,
  1249.  * use the relevant QWidget function (showFullScreen etc.), do not
  1250.  * call directly the slot connected to the toggled() signal. The slot
  1251.  * still needs to explicitly set the window state though.
  1252.  * @since 3.2
  1253.  */
  1254. class KDEUI_EXPORT KToggleFullScreenAction : public KToggleAction
  1255. {
  1256.     Q_OBJECT
  1257. public:
  1258.     /**
  1259.      * Create a KToggleFullScreenAction
  1260.      *  @param cut The corresponding keyboard accelerator (shortcut).
  1261.      *  @param receiver The SLOT's parent.
  1262.      *  @param slot The SLOT to invoke to execute this action.
  1263.      *  @param parent This action's parent.
  1264.      *  @param window the window that will switch to/from full screen mode
  1265.      *  @param name An internal name for this action.
  1266.      */
  1267.     KToggleFullScreenAction( const KShortcut &cut,
  1268.                              const QObject* receiver, const char* slot,
  1269.                              QObject* parent, QWidget* window,
  1270.                              const char* name );
  1271.     virtual ~KToggleFullScreenAction();
  1272.  
  1273.     /**
  1274.      * Sets the window that will be related to this action.
  1275.      */
  1276.     void setWindow( QWidget* window );
  1277. public slots:
  1278.     virtual void setChecked( bool );
  1279. protected:
  1280.     /**
  1281.      * @internal
  1282.      */
  1283.     virtual bool eventFilter( QObject* o, QEvent* e );
  1284. private:
  1285.     QWidget* window;
  1286. protected:
  1287.     virtual void virtual_hook( int id, void* data );
  1288. private:
  1289.     class KToggleFullScreenActionPrivate;
  1290.     KToggleFullScreenActionPrivate *d;
  1291. };
  1292.  
  1293.  
  1294. /**
  1295.  * An action that automatically embeds a widget into a
  1296.  * toolbar.
  1297.  */
  1298. class KDEUI_EXPORT KWidgetAction : public KAction
  1299. {
  1300.     Q_OBJECT
  1301. public:
  1302.     /**
  1303.      * Create an action that will embed widget into a toolbar
  1304.      * when plugged. This action may only be plugged into
  1305.      * a toolbar.
  1306.      */
  1307.     KWidgetAction( QWidget* widget, const QString& text,
  1308.                    const KShortcut& cut,
  1309.                    const QObject* receiver, const char* slot,
  1310.                    KActionCollection* parent, const char* name );
  1311.     virtual ~KWidgetAction();
  1312.  
  1313.     /**
  1314.      * Returns the widget associated with this action.
  1315.      */
  1316.     QWidget* widget() { return m_widget; }
  1317.  
  1318.     void setAutoSized( bool );
  1319.  
  1320.     /**
  1321.      * Plug the action. The widget passed to the constructor
  1322.      * will be reparented to w, which must inherit KToolBar.
  1323.      */
  1324.     virtual int plug( QWidget* widget, int index = -1 );
  1325.     /**
  1326.      * Unplug the action. Ensures that the action is not
  1327.      * destroyed. It will be hidden and reparented to 0L instead.
  1328.      */
  1329.     virtual void unplug( QWidget *w );
  1330. protected slots:
  1331.     void slotToolbarDestroyed();
  1332. private:
  1333.     QGuardedPtr<QWidget> m_widget;
  1334.     bool                 m_autoSized;
  1335. protected:
  1336.     virtual void virtual_hook( int id, void* data );
  1337. private:
  1338.     class KWidgetActionPrivate;
  1339.     KWidgetActionPrivate *d;
  1340. };
  1341.  
  1342. class KDEUI_EXPORT KActionSeparator : public KAction
  1343. {
  1344.     Q_OBJECT
  1345. public:
  1346.     KActionSeparator( QObject* parent = 0, const char* name = 0 );
  1347.     virtual ~KActionSeparator();
  1348.  
  1349.     virtual int plug( QWidget *widget, int index = -1 );
  1350.  
  1351. protected:
  1352.     virtual void virtual_hook( int id, void* data );
  1353. private:
  1354.     class KActionSeparatorPrivate;
  1355.     KActionSeparatorPrivate *d;
  1356. };
  1357.  
  1358. /**
  1359.  * An action for pasting text from the clipboard.
  1360.  * It's useful for text handling applications as
  1361.  * when plugged into a toolbar it provides a menu
  1362.  * with the clipboard history if klipper is running.
  1363.  * If klipper is not running, the menu has only one
  1364.  * item: the current clipboard content.
  1365.  *
  1366.  * @since 3.2
  1367.  */
  1368. class KDEUI_EXPORT KPasteTextAction: public KAction
  1369. {
  1370.     Q_OBJECT
  1371. public:
  1372.     /**
  1373.      * Create a KPasteTextAction, with a text, an icon, an accelerator,
  1374.      * a slot connected to the action, parent and name.
  1375.      *
  1376.      * If you do not want or have a keyboard accelerator, set the
  1377.      * @p cut param to 0.
  1378.      *
  1379.      * @param text The text that will be displayed.
  1380.      * @param icon The icon to display.
  1381.      * @param cut The corresponding keyboard accelerator (shortcut).
  1382.      * @param receiver The SLOT's owner.
  1383.      * @param slot The SLOT to invoke to execute this action.
  1384.      * @param parent This action's parent.
  1385.      * @param name An internal name for this action.
  1386.      */
  1387.     KPasteTextAction( const QString& text, const QString& icon, const KShortcut& cut,
  1388.                   const QObject* receiver, const char* slot,
  1389.                   QObject* parent = 0, const char* name = 0 );
  1390.  
  1391.     virtual ~KPasteTextAction();
  1392.  
  1393.     /**
  1394.     * Controls the behavior of the clipboard history menu popup.
  1395.     *
  1396.     * @param mode If false and the clipboard contains a non-text object
  1397.     *             the popup menu with the clipboard history will appear
  1398.     *             immediately as the user clicks the toolbar action; if
  1399.     *             true, the action works like the standard paste action
  1400.     *             even if the current clipboard object is not text.
  1401.     *             Default value is true.
  1402.     */
  1403.     void setMixedMode(bool mode);
  1404.  
  1405.     virtual int plug( QWidget *widget, int index = -1 );
  1406.  
  1407. protected slots:
  1408.     void menuAboutToShow();
  1409.     void menuItemActivated( int id);
  1410.     virtual void slotActivated();
  1411.  
  1412. protected:
  1413.     virtual void virtual_hook( int id, void* data );
  1414.  
  1415. private:
  1416.     KPopupMenu *m_popup;
  1417.     bool m_mixedMode;
  1418.     class KPasteTextActionPrivate;
  1419.     KPasteTextActionPrivate *d;
  1420. };
  1421.  
  1422. #endif
  1423.